package com.bbva.gptf.back.dominio;

import java.math.BigDecimal;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.roo.addon.dbre.RooDbManaged;
import org.springframework.roo.addon.entity.RooEntity;
import org.springframework.roo.addon.javabean.RooJavaBean;
import org.springframework.roo.addon.tostring.RooToString;

@RooJavaBean
@RooToString
@RooEntity(versionField = "", table = "TGPT036_VAR_GLOBAL", schema = "DBSGPT")
@RooDbManaged(automaticallyDelete = true)
public class Tgpt036VarGlobal {
	public static Tgpt036VarGlobal findTgpt036VarGlobalByNbVariable(
			final String nbVariable) {
		if (nbVariable == null) {
			return null;
		}
		return entityManager()
				.createQuery(
						"SELECT o FROM Tgpt036VarGlobal o WHERE nbVariable = :nbVariable",
						Tgpt036VarGlobal.class)
				.setParameter("nbVariable", nbVariable).getSingleResult();
	}

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO, generator = "sq_var_global")
	@SequenceGenerator(name = "sq_var_global", sequenceName = "SQ_VAR_GLOBAL")
	@Column(name = "CD_VARIABLE")
	private BigDecimal cdVariable;

	@Column(name = "TM_UMO")
	@Temporal(TemporalType.TIMESTAMP)
	@DateTimeFormat(style = "S-")
	private Date tmUmo;
}
